package org.xteam.sled.semantic.exp;

public abstract class ExpFactor extends Exp {
	
	protected int factor;
	protected Exp expr;

	public ExpFactor(int factor, Exp expr) {
		this.factor = factor;
		this.expr = expr;
		this.expr.setParent(this);
	}
	
	public Exp getExpr() {
		return expr;
	}
	
	public int factor() {
		return factor;
	}
	
	public int hashCode() {
		return expr.hashCode() + factor;
	}
	
	public void replace(Exp oldExp, Exp newExp) {
		if (oldExp.equals(expr))
			expr = newExp;
	}

}
